#include "widget.h"
#include "ui_widget.h"
#include<QRect>
int a=0;
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    ui->label->setText("非常感谢你的100元，爱你么么哒");
}

void Widget::on_pushButton_2_pressed()
{
    QFont f1=ui->pushButton_2->font();
    int b=f1.pointSize();
    if(b>3){
        f1.setPixelSize(b-5);
    }
    if(a==0){
        ui->label->setText("再考虑一下嘛");
        f1.setPixelSize(3);
    }
    else if(a==1){
        ui->label->setText("求求你了");
         f1.setPixelSize(9);
    }
    a++;
    QRect rect=ui->pushButton_2->geometry();
    int width=this->geometry().width();
    int height=this->geometry().height();
    int x=rand()%width;
    int y=rand()%height;
    int pwidth=ui->pushButton_2->geometry().width();
    int pheight=ui->pushButton_2->geometry().height();
    if(pwidth>30)pwidth-=10;
    if(pheight>30)pheight-=10;
    ui->pushButton_2->setGeometry(x,y,pwidth,pheight);
}
